package com.artezio.vacation.service;

import com.artezio.vacation.dao.VacationDAO;
import com.artezio.vacation.domain.Vacation;
import com.artezio.vacation.domain.VacationStatus;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * IntelliJ IDEA nick 19.02.13
 */
@Service
public class VacationService {

    public static final Logger LOGGER = Logger.getLogger(VacationService.class);

    @Autowired
    private VacationDAO vacationDAO;

    @Autowired
    private MessageService messageService;

    public void requestVacation(Vacation v) {
        if (v.getStatus() != VacationStatus.REQUEST) {
            //
        }

        vacationDAO.saveOrUpdate(v);
        messageService.sendVacationRequest(v);
    }
}
